package com.mall4j.cloud.order.infrustructure.persist.repository;

import com.mall4j.cloud.order.domain.entity.Order;
import com.mall4j.cloud.order.domain.repository.OrderRepository;
import com.mall4j.cloud.order.infrustructure.persist.dao.OrderMapper;
import com.mall4j.cloud.order.infrustructure.persist.po.OrderPo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class OrderRepositoryImpl implements OrderRepository {

    @Resource
    OrderMapper orderMapper;

    @Override
    public void save(Order order) {
        OrderPo orderPo = new OrderPo();
        orderPo.setOrderNo(order.getOrderNo());
        orderPo.setStatus(order.getStatus());
        orderPo.setCreateTime(order.getCreateTime());
        orderPo.setUpdateTime(order.getUpdateTime());
        orderPo.setUserId(order.getUserId());
        orderPo.setShopId(order.getShopId());
        orderPo.setShopName(order.getShopName());
        orderMapper.insert(orderPo);
    }
}
